
<!--_meta 作为公共模版分离出去-->
{include file="public/header"}
<!--/meta 作为公共模版分离出去-->
<title>账户列表</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="stylesheet" href="/static/page/page.css">
<body>
<div class="wap-container">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
        首页
        <span class="c-gray en">/</span>
        运营账户
        <span class="c-gray en">/</span>
        账户管理
        <a class="btn btn-success radius f-r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>

    <article class="Hui-admin-content clearfix">

        <div class="panel mt-20">
            <div class="panel-body">
                <div class="clearfix">
                    {if $op_id eq 1}
                    <span class="f-l">
                        <a href="javascript:;" onclick="admin_add('用户迁移','/operater/user/moveUser')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 用户迁移</a>
                    </span>
                    {/if}
                    <span class="f-r">共有数据：<strong>{$data.total}</strong> 条</span>
                </div>
                <div class="mt-20 clearfix">
                    <table class="table table-border table-bordered table-bg table-hover table-sort">
                        <thead>
                        <tr>
                            <th scope="col" colspan="9">账户列表</th>
                        </tr>
                        <tr class="text-c">
                            <th width="40">ID</th>
                            <th width="150">昵称</th>
                            <th width="90">手机号</th>
                            <th width="130">等级</th>
                            <th width="130">性别</th>
                            <th width="100">是否禁用</th>
                            <th width="100">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="data['data']" id="vo"}
                        <tr class="text-c">
                            <td>{$vo.id}</td>
                            <td>{$vo.nickname}</td>
                            <td>{$vo.mobile}</td>
                            <td>
                                {switch $vo.grade}
                                {case 1}普通会员{/case}
                                {case 2}白金VIP{/case}
                                {case 3}钻石VIP{/case}
                                {case 4}商家VIP{/case}
                                {default /}无
                                {/switch}
                            </td>
                            <td>
                                {switch $vo.sex}
                                    {case 1}男{/case}
                                    {case 2}女{/case}
                                    {default /}未知
                                {/switch}
                            </td>
                            <td class="td-status">
                                {if $vo.status eq 1}
                                <span class="label label-success radius">正常</span>
                                {else/}
                                <span class="label radius">禁用</span>
                                {/if}
                            </td>
                            <td class="td-manage">
                                <a style="text-decoration:none" class="ml-5" onClick="product_edit('订单记录','/operater/operation/order/user_id/{$vo.id}','{$vo.id}')" href="javascript:;" title="查看记录"><i class="Hui-iconfont">&#xe687;</i></a>
<!--                                <a title="编辑" href="javascript:;" onclick="admin_edit('账户编辑','/operater/operation/edit/id/{$vo.id}','{$vo.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>-->
<!--                                <a title="删除" href="javascript:;" onclick="admin_del(this,'{$vo.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>-->
                            </td>
                        </tr>
                        {/volist}

                        </tbody>
                    </table>
                    <div class="paginate">{$page|raw}</div>
                </div>
            </div>
        </div>
    </article>
</div>

<!--_footer 作为公共模版分离出去-->
{include file="public/footer"}
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/static/admin/static/business/js/main.js"></script>
<script type="text/javascript">
    $(function(){
        runDatetimePicker();
        // 全选 页面调用
        $(".table").HuicheckAll(
            {
                checkboxAll: 'thead input[type="checkbox"]',
                checkbox: 'tbody input[type="checkbox"]'
            },
            function(checkedInfo) {
                console.log(checkedInfo);
            }
        )
    });

    // 删除
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.post("{:url('delete')}",{id:id},function(data){
                if(data.code == 200){
                    $(obj).parents("tr").remove();
                    layer.msg(data.msg,{icon:1,time:1000});
                }else{
                    layer.msg(data.msg,{icon:1,time:1000});
                }
            });
        });
    }
    /*账户-停用*/
    function admin_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.post('/operater/operation/editStatus',{id:id});
            $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
            $(obj).remove();
            layer.msg('已停用!',{icon: 5,time:1000});
        });
    }

    /*账户-启用*/
    function admin_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.post('/operater/operation/editStatus',{id:id});
            $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!', {icon: 6,time:1000});
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
